package com.vay.de.dang.online.web;

public class ReqResult {

    public int code;
    public Object result;
    public String msg;

    public ReqResult(int code, Object result) {
        this.code = code;
        this.result = result;
    }

    public ReqResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public boolean isOk() {
        return code == 0;
    }

    public static ReqResult ok(Object result) {
        return new ReqResult(0, result);
    }

    public static ReqResult ok(String msg) {
        return new ReqResult(0, msg);
    }

    public static ReqResult error(String msg) {
        return new ReqResult(-1, msg);
    }

}
